feat(goto): add --wait-loaded flag for async-rendered content#71
Merged
feat(goto): add --wait-loaded flag for async-rendered content#71
Conversation
Add waitForLoaded function to browser-launcher that combines three phases: network idle + DOM stability (via existing waitForStable), loading indicator absence detection (spinners, skeletons, progress bars, aria-busy elements), and a final 300ms DOM quiet period. Wire --wait-loaded into all four goto snapshot paths, register as boolean flag, expose in macro helpers, and update help text. Closes #68
- Guard against null document.body in indicator check and MutationObserver - Limit TreeWalker to 5000 nodes to prevent DoS on huge DOMs - Use querySelectorAll with combined selectors for efficient polling - Ensure MutationObserver disconnect in all resolve paths - Parse loadedTimeout once at top of goto case (DRY) - Add tests for null guard, node limit, querySelectorAll, DRY timeout
parseInt can return NaN for malformed input. Guard against NaN and negative values by falling back to the 15000ms default.
Previous validation with Math.max/|| allowed negative values to produce 0ms timeout. Use explicit > 0 check so NaN, negative, and zero all fall back to the 15000ms default.
Keep improved timeout validation from feature branch and incorporate auth wall checkpoint tests from main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--wait-loadedflag to thegotoaction for pages with async-rendered contentTest Plan
npm run validatepassesRelated Issues
Closes #68